<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:head>

	<style type="text/css">
.ui-layout-north {
	z-index: 20 !important;
	overflow: visible !important;;
}

.ui-layout-north .ui-layout-unit-content {
	overflow: visible !important;
}

.ui-widget {
	font-size: 10px !important;
}

.size {
	width: 550px;
	position: relative;
	left: 30%;
	top: 10%;
}

.centro {
	top: 50%
}

.tabela {
	width: 750px;
}
</style>


	<title>Cadastro de Determinação/Elemento</title>
</h:head>

<h:body>
	<ui:decorate template="/templateBase.xhtml">

		<ui:define name="center">
			<h:form prependId="true" id="formCadastroDeterminacaoElemento">
				<br />
				<br />
				<br />
				<br />
				<p:panel header="Cadastro de Determinação" styleClass="size"
					toggleable="true"
					footer="SIGLAS - Sistema de Gerenciamento de Laboratório de Análise de Solo">
					<p:growl id="growl" life="3000" />

					<br />
					<div align="center">
						<h:panelGrid columns="3">
							<h:outputText value="Determinação" />
							<p:inputText size="50" disabled="true" id="txtDeterminacao"
								value="#{DeterminacaoElementoBacking.nomeDeterminacao}"
								required="true" requiredMessage="Informe a determinação!" />
							<p:commandButton icon="ui-icon-search" oncomplete="dlg.show()"
								actionListener="#{DeterminacaoElementoBacking.carregarDeterminacao}"
								update=":formPesquisaDeterminacao:tabelaDeterminacao"
								process="@all" immediate="true" />

							<h:outputText value="Elemento: " />
							<p:inputText size="50" disabled="true" id="txtElemento"
								required="Informe o elemento!"
								value="#{DeterminacaoElementoBacking.nomeElemento}" />
							<p:commandButton icon="ui-icon-search"
								oncomplete="dlgElemento.show()"
								actionListener="#{DeterminacaoElementoBacking.carregarElemento}"
								update=":formPesquisaElemento:tabelaElemento" process="@all"
								immediate="true" />
						</h:panelGrid>
					</div>
					<br />

					<div align="center">
						<h:panelGrid columns="4">
							<p:commandButton value="Salvar"
								actionListener="#{DeterminacaoElementoBacking.salvar}" ajax="false" update="formCadastroDeterminacaoElemento"
								icon="ui-icon-disk" />
							<p:commandButton value="Alterar" icon="ui-icon-pencil" />
							<p:commandButton value="Limpar" action="#" ajax="false"
								icon="ui-icon-cancel" />
						</h:panelGrid>
					</div>
				</p:panel>
			</h:form>

			<h:form prependId="false" id="formPesquisaElemento">
				<p:dialog id="pesquisaElemento" widgetVar="dlgElemento" appendToBody="true" modal="true"
					header="Pesquisar Elemento" closable="true" height="450"
					width="400" resizable="false" showEffect="clip" hideEffect="clip">

					<p:dataTable var="e"
						value="#{DeterminacaoElementoBacking.listaElemento}" rows="10"
						widgetVar="elementoTabela" paginator="true" id="tabelaElemento"
						emptyMessage="Nenhum registro foi encontrado, tente novamente!">
						<h:outputText value="Elementos Cadastrados" />
						<p:column filterBy="#{e.descricao}">
							<f:facet name="header">
								<h:outputText value="Descrição" />
							</f:facet>
							<h:outputText value="#{e.descricao}" />
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Ações" />
								</f:facet>

								<p:commandButton value="Selecionar"
									action="#{DeterminacaoElementoBacking.onRowSelectElemento(e)}"
									update=":formCadastroDeterminacaoElemento" process="@this"
									onclick="dlgElemento.hide()" />
							</div>
						</p:column>

					</p:dataTable>
				</p:dialog>
			</h:form>

			<h:form prependId="false" id="formPesquisaDeterminacao">
				<p:dialog id="pesquisaDeterminacao" widgetVar="dlg"
					header="Pesquisar Determinacao" closable="true" height="400"
					width="400" resizable="false" showEffect="clip" hideEffect="clip">

					<p:dataTable var="d"
						value="#{DeterminacaoElementoBacking.listaDeterminacao}" rows="10"
						widgetVar="DeterminacaoTabela" paginator="true" rowKey="#{d.codigo}"
						id="tabelaDeterminacao"
						emptyMessage="Nenhum registro foi encontrado, tente novamente!">
						<h:outputText value="Determinacao Cadastradas" />
						<p:column filterBy="#{d.descricao}" >
							<f:facet name="header">
								<h:outputText value="Descrição" />
							</f:facet>
							<h:outputText value="#{d.descricao}" />
						</p:column>

						<p:column>
							<div align="center">
								<f:facet name="header">
									<h:outputText value="Ações" />
								</f:facet>

								<p:commandButton value="Selecionar"
									action="#{DeterminacaoElementoBacking.onRowSelectDeterminacao(d)}"
									update=":formCadastroDeterminacaoElemento" process="@this"
									onclick="dlg.hide()" />
							</div>
						</p:column>
					</p:dataTable>
				</p:dialog>
			</h:form>

		</ui:define>
	</ui:decorate>
</h:body>
</html>